package com.dk.controller;


import com.dk.bean.Result;
import com.dk.em.ResultEnum;
import com.dk.pojo.CarUser;
import com.dk.service.CarUserService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 张成涛
 * @since 2021-08-11
 */
@RestController
@RequestMapping("/carUser")
public class CarUserController {
        @Autowired
        private CarUserService carUserService;
       /* @Autowired
        private CarUserMapper  carUserMapper;*/
    //查询
    @ApiOperation(value = "用户查询方法" )
    @GetMapping
    public Result selectById(){
        List<CarUser> order = carUserService.selectById();
        System.out.println(order);
        return Result.buildResult(ResultEnum.SUCCESS).setData(order);
    }
    //修改
    @ApiOperation(value = "用户修改方法")
    @PutMapping
    public Result update(@RequestBody CarUser user){
        carUserService.toUpdate(user);
        return Result.buildResult(ResultEnum.SUCCESS);

    }
/*    //排行榜
    @ApiOperation(value = "排行榜")
    @GetMapping
    public Result ranking(long id){

            return null;
    }*/
}

